package com.starleague.jpa;

public interface JpaTransaction<ID, DAO_BASE extends JpaDao<ID>>
        extends AutoCloseable
{
    void commit();

    void rollback();

    <DAO extends DAO_BASE> DAO findById(Class<DAO> daoClass,
                                        ID daoId);

    <DAO extends DAO_BASE> DAO findByUid(Class<DAO> daoClass,
                                         String dtoUid);

    // <DAO extends DAO_BASE> List<DAO> findAll(Class<DAO> daoClass);

    <DAO extends DAO_BASE> void persist(DAO dao);

    // <DAO extends JpaDao<?>> void refresh(DAO dao);

    <DAO extends DAO_BASE> DAO merge(DAO dao);

    // Query createNamedQuery(final String queryName);
    // Query createQuery(final String queryStr);
}
